// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'mint-ui/lib/style.css';
import './assets/style.css';
import './assets/iconfont/iconfont.css';
import Vue from 'vue'
import { Swipe, SwipeItem, Progress} from 'mint-ui';
import App from './App'
import router from './router'
import VeeValidate, { Validator } from 'vee-validate';
import messages from './assets/js/zh_CN';
import 'babel-polyfill';

// 配置中文
Validator.addLocale(messages);

const config = {
  locale: 'zh_CN'
};


// 自定义validate
const dictionary = {
   zh_CN: {
      messages: {
        email: () => '请输入正确的邮箱格式',
        required: ( field )=> "请输入" + field + '!'
      },
      attributes:{
        email:'邮箱',
        password:'登录密码',
        repassword:'确认密码',
        account: '登录账户',
        phone: '手机号码',
        code: '验证码',
        amount:'信贷总金额',
        interest:'年利率',
        purpose:'借款用途',
        iborrowLimit:'借款期限',
        minimum:'最低投标金额',
        tallest:'最多投标金额',
        validtime:'有效时间',
        repayment:'还款方式',
        award:'是否有投标奖励'
      }
  }
};

Validator.updateDictionary(dictionary);

Validator.extend('phone', {
  messages: {
    zh_CN:field => field + '必须是11位手机号码'
  },
  validate: value => {
    return value.length == 11 && /^((13|14|15|17|18)[0-9]{1}\d{8})$/.test(value)
  }
});

Validator.extend('password', {
  messages: {
    zh_CN:field => field + '必须是6-18位数字和字符！'
  },
  validate: value => {
  	return value.length >= 6 && value.length <=18 && /^[A-Za-z0-9]+$/.test(value);
  }
});


//Vue.use(MintUI);
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);
Vue.component(Progress.name, Progress);

Vue.config.productionTip = false

Vue.use(VeeValidate,config);
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})
